const CONFIG = require('../src/CONFIG.js');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require("webpack");
let pages={
  entry:{},
  plugins:[]
}
let nameArr=[];
for (let i = 0; i < CONFIG.length; i++) {
  pages.entry[CONFIG[i].name]=`./src/pages/${CONFIG[i].name}/index.js`;

  pages.plugins.push(new HtmlWebpackPlugin({
        template:`./src/pages/${CONFIG[i].name}/index.html`,
        filename:`./${CONFIG[i].name}.html`,
        chunks:[CONFIG[i].name]
    })
  )
  nameArr.push(CONFIG[i].name);
}
// pages.plugins.push(new webpack.optimize.CommonsChunkPlugin({
//   name:"common-css",
//   chunks:nameArr
// }))
module.exports=pages;